# $Id: PKGBUILD 173941 2012-12-28 13:12:00Z allan $
# Maintainer: Dan McGee <dan@archlinux.org>
# Maintainer: Allan McRae <allan@archlinux.org>

pkgname=valgrind
pkgver=3.8.1
pkgrel=2
pkgdesc="A tool to help find memory-management problems in programs"
arch=('i686' 'x86_64')
license=('GPL')
url="http://valgrind.org/"
depends=('glibc>=2.17' 'glibc<2.18' 'perl')
makedepends=('gdb')
options=('!emptydirs')
source=(http://valgrind.org/downloads/${pkgname}-${pkgver}.tar.bz2
        valgrind-3.8.1-glibc-2.17.patch)
md5sums=('288758010b271119a0ffc0183f1d6e38'
         'e87c34f9f9ce0040d141b3bd57842b5c')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -p1 -i $srcdir/valgrind-3.8.1-glibc-2.17.patch

  if [ "${CARCH}" = "x86_64" ]; then
    ./configure --prefix=/usr --mandir=/usr/share/man --enable-only64bit
  else
    ./configure --prefix=/usr --mandir=/usr/share/man
  fi

  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
